/**
 * 解析html内容
 * @description 解析html内容, 用法传入字符串 返回值为string类型
 * ```
 * parseHtml(`<span data-w-e-type="emoji" class='emoji'>JUYwJTlGJTk4JTg0</span>` => `<span data-w-e-type="emoji" class='emoji'>😄</span>`
 * ```
 * @export
 * @param {string} str
 * @return {*}  {string}
 */
export function parseHtml(str: string): string {
  // 表情解析
  return str.replaceAll(
    /<span data-w-e-type="emoji" class='emoji'>(.+?)<\/span>/g,
    (x, emoji) => {
      const tempVal = decodeURIComponent(atob(emoji));
      return `<span data-w-e-type="emoji" class='emoji'>${tempVal}</span>`;
    },
  );
}
